const API_KEY = '10a41b6cb03e5806254ccf7961afd6a7';
const BASE_URL = 'https://api.themoviedb.org/3'

// 获取热门电影列表
export const getPopularMovies = async () => {
    const response = await fetch(`${BASE_URL}/movie/popular?api_key=${API_KEY}`);
    const data = await response.json();
    return data.results;
}

// 获取电影详情
export const searchMovies = async (query) => {
    const response = await fetch(`${BASE_URL}/search/movie?api_key=${API_KEY}&query=${encodeURIComponent(query)}`);
    const data = await response.json();
    return data.results;
}